using System.Collections.Generic;

namespace DesktopApp.Models // Create a new Models folder/namespace
{
    // Represents a saved template containing a set of rules.
    public class LogProcessingTemplate
    {
        public string Name { get; set; } = string.Empty;

        // Store copies of the rules, not references to the main list's ViewModels
        // We might need a simpler RuleData class if RuleItemViewModel contains UI state.
        // For now, let's assume we can store copies of RuleItemViewModel (needs parameterless ctor or factory)
        // Or better: Define a RuleData class.
        public List<RuleDefinition> Rules { get; set; } = new List<RuleDefinition>();

        // Parameterless constructor for serialization/deserialization
        public LogProcessingTemplate() { }
    }

    // A simpler class to hold only the data needed to reconstruct a rule,
    // suitable for saving/loading and independent of ViewModel state.
    public class RuleDefinition
    {
        public string Name { get; set; } = string.Empty;
        public string Description { get; set; } = string.Empty;
        public ViewModels.RuleType Type { get; set; }
        public string? Keyword { get; set; }
        public string? Replacement { get; set; }
        public string? Pattern { get; set; }
        public bool IsEnabled { get; set; }

        // Optional: Parameterless constructor
        public RuleDefinition() { }

        // Optional: Constructor to create from ViewModel
        public RuleDefinition(ViewModels.RuleItemViewModel vm)
        {
             Name = vm.Name;
             Description = vm.Description;
             Type = vm.Type;
             Keyword = vm.Keyword;
             Replacement = vm.Replacement;
             Pattern = vm.Pattern;
             IsEnabled = vm.IsEnabled; // Save enabled state within the template
        }

        // Optional: Method to create ViewModel from data
        public ViewModels.RuleItemViewModel ToViewModel()
        {
            return new ViewModels.RuleItemViewModel
            {
                 Name = this.Name,
                 Description = this.Description,
                 Type = this.Type,
                 Keyword = this.Keyword,
                 Replacement = this.Replacement,
                 Pattern = this.Pattern,
                 IsEnabled = this.IsEnabled
            };
        }
    }
} 